1. Field of the Invention
The present invention relates to computer graphics, and in particular, to shading computer-generated images.
2. Related Art
Shading is an important component that contributes to the realism of a geometric scene to be rendered. The calculations associated with shading can be split into two parts: finding surface reflectance properties at each point being shaded, and computing the incident illumination at the point being shaded. Surface reflectance properties are used by computer graphics application programming interfaces (graphics APIs) to define how a surface dissipates light. For example, one graphics API, OpenGL(trademark) by Silicon Graphics, Inc., supports five surface reflectance properties: diffuse and ambient properties, specular and shininess properties, and an emissive property. See, e.g. R. Fosner, OpenGL(trademark) Programming for Windows 95 and Windows NT (Addison-Wesley Pub.: Reading, Mass. 1997), Chapter 9, xe2x80x9cColors, Materials, and Lights,xe2x80x9d pp. 181-201.
The shading calculation for an incident light component, however, is fairly primitive in current graphics hardware. As such the overall shading realism is diminished regardless of the sophistication in which surface reflectance properties are represented. In current commercial graphics shaders, incident light sources are only represented by point source lighting models. For example, OpenGL(trademark) only supports directional lights, point light sources with varying distance-based falloff functions, and spot lights, which provide illumination in a cone.
One important type of point light source not yet represented in commercial graphics shaders is a point light source with emission varying by direction, as described by the IES standard luminaire file format. The IES standard luminaire file format is a standard representation of emission from complex emitters, assuming an observer is sufficiently far away that the source can be treated as a point emitter. An IES recommended standard file format for electronic transfer for photometric data, IES LM-63-1990, is available from the Illuminating Engineering Society of North America.
In contrast to point lights, real-world light sources are area sources. Current methods for computing incident light from an area light source are impractical for computer graphics applications and systems. Current techniques are either too inefficient and expensive for hardware or real-time applications, or are only effective for area luminaires with limited shapes or emission distributions. For example, Ashdown has developed a method for mapping the emission distributions from complex area light sources onto a sphere (Ashdown, I., J. Illuminating Eng. Soc. 22(1):163-180 (Winter 1993)). Outgoing emission at a number of points on the sphere is computed for each point shadedxe2x80x94the computational requirements of this technique are excessive for current graphics hardware. Stock has developed a similar method, where the directional distribution of a light source is computed at various points over a sphere (Stock, R. D., Fourier Formulation of Illumination Optics and Computer-Automated Reflector Design, Ph.D. thesis, CMU (1995)). This distribution is projected into a Fourier space, and the coefficients are interpolated over the source of the sphere to construct intermediate distributions at arbitrary points. However, the techniques of Ashdown and Stock are still impractical for hardware or real-time applications.
Snyder has investigated closed form expressions for incident illumination for various types of area light sources (Snyder, J., xe2x80x9cArea light sources for real-time graphics,xe2x80x9d Microsoft Res. Tech. Rep. MSR-TR-96-11 (March 1996)); this work is based on a paper written by Arvo in SIGGRAPH ""95 (Arvo, J., xe2x80x9cApplications of irradiance tensors to the simulation of non-Lambertian phenomena,xe2x80x9d in ACM SIGGRAPH ""95 Conf Proc., Cook, R., ed., Addison Wesley (August 1995), pp. 335-342). However, Snyder""s techniques are still not sufficiently efficient for hardware implementation, and are limited to a small set of types of emitters.
Sun et al. have investigated techniques for tabularizing the calculation of the differential area to area form-factor (Sun, J., et al., Computer Graphics Forum 12(4):191-198 (1993)). This computation is equivalent to finding the incident energy from a diffusely emitting light source to a point. This technique reduces computation by tabularizing some aspects of it, but still has significant computational demands and does not easily generalize to more general emitter shapes or non-diffuse emission distributions.
Algorithms based on radiosity have been used to generate images of environments, taking into account both light from area light sources as well as interreflections of light from non-emissive surfaces. For a general introduction to radiosity, see: Francois Sillion and Claude Puech, Radiosity and Global Illumination, Morgan Kaufmann Publ: USA, 1994. Radiosity algorithms typically compute a simulation of light transport in a time-consuming pre-processing step, and the result can then be displayed interactively. With radiosity techniques, the lighting solution is computed at a fixed set of points in the environment independent of the viewing parameters used for display. This one set of solution points can never be sufficient to provide an accurate solution for all possible viewing parameters.
Although complete radiosity solutions are impractical for interactive viewing of scenes with area light sources, some of the techniques used in radiosity solutions offer possibilities for computing light from area sources. These techniques are too computationally expensive and too inflexible for general applicability.
One of the techniques commonly used in radiosity algorithms to compute incident light at a point (the form-factor computation) is based on computing a contour integral around the edges of a polygonal light source (Daniel R. Baum and Holly E. Rushmeier and James M. Winget, xe2x80x9cImproving Radiosity Solutions Through the Use of Analytically Determined Form-Factorsxe2x80x9d, SIGGRAPH ""89 Proceedings, p. 325-334.). Although this is a potentially exact computation of the incident light, it is currently too expensive to evaluate in an interactive system, and cannot easily be extended to account for lights with non-diffuse emission distributions.
Wallace et al. have proposed a more efficient but less accurate method to compute form-factors, based on a simplifying assumption that the light is disc shaped (John R. Wallace and Kells A. Elmquist and Eric A. Haines, xe2x80x9cA Ray Tracing Algorithm for Progressive Radiosityxe2x80x9d, SIGGRAPH ""89 Proceedings). This is not an exact computation, unless the light is disc shaped and the point where incident light is being computed is parallel to the emitter and directly above or below it. Furthermore, the computation is still not efficient enough for real-time applications and cannot be easily extended to account for lights with varying emission distributions.
Ward has developed algorithms for global illumination and area light source computation based on computing scalar irradiance values at points on surfaces and interpolating them to compute irradiance at nearby points. See, Ward, Gregory J., et al., xe2x80x9cA Ray Tracing Solution for Diffuse Interreflectionxe2x80x9d, in Computer Graphics (SIGGRAPH ""88 Proc.); Ward, Gregory J. and Heckbert, P., xe2x80x9cIrradiance Gradientsxe2x80x9d in Third Eurographics Workshop on Rendering, May 1992; Ward, Gregory J., xe2x80x9cThe RADIANCE Lighting Simulation and Rendering Systemxe2x80x9d in SIGGRAPH ""94 Proc., Orlando, Fla., Jul. 24-29, 1994. Although these algorithms produce high-quality lighting simulations and naturally adapt to the rate at which irradiance is changing in a scene, they depend on storing irradiance estimates in a spatial data structure that is too complex for interactive applications, and the irradiance estimates are combined and weighted by a function that is also too complex for interactive applications. This algorithm doesn""t store irradiance in a vector form, and doesn""t tabularize irradiance into a regular table structure which is necessary for efficient look up operations in hardware.
Other volumetric illumination representations have been developed by Chiu, K., et al., xe2x80x9cThe Light Volume: An Aid To Rendering Complex Environmentsxe2x80x9d, Eurographics Workshop on Rendering, 1996 and Greger, G., et al., xe2x80x9cThe Irradiance Volumexe2x80x9d, to appear in IEEE Computer Graphics and Applications, 1997.) These approaches also store representations of scene irradiance in a spatial data structure and interpolate them for intermediate points in the scene. These algorithms also require costly look-ups and significant computation to determine irradiance at points being shaded, making them unsuitable for interactive applications. This algorithm doesn""t store irradiance in a vector form, and doesn""t tabularized irradiance into a regular table structure which is necessary for efficient look up operations in hardware.
An efficient technique for computing incident-light from complex point or area luminaires is needed. More complex luminaires are important for simulating more realistic scenes. A surface illuminated by a large area light source has a significantly softer appearance than if it were illuminated by a point source. Area light sources can also model common light sources (e.g., fluorescent tubes) more accurately than point sources.
Thus, a computer graphics method and system for shading and animation is needed which can efficiently compute incident light from point and/or area light sources at interactive rates. An efficient and general computing technique is needed which can compute incident light from a wide variety and range of point and area light sources in a rendered scene including sources with potentially complex emission distribution functions. Light sources also need to be represented when given data in the form of point light sources with emission varying by direction, as described by the IES standard luminaire file format.
According to one embodiment of the present invention, a method, system, and computer program product are provided that represent complex point and area illumination in computer graphics shading. An irradiance vector field table representative of an irradiance field for a scene to be rendered is generated and stored. During rendering, the scene is then lit based on irradiance vectors in the irradiance vector field table.
For each point being lit, a corresponding irradiance vector is looked-up in the irradiance vector field table. A vector operation is performed between the irradiance vector and a surface normal for the point to compute an irradiance energy component. The irradiance energy component is then used in determining a final shade value for the point.
In one example hardware embodiment, a look-up unit looks up and interpolates irradiance vectors for selected points in the irradiance vector field table to compute an interpolated irradiance vector. A dot product unit calculates a dot product between the interpolated irradiance vector and a surface normal for the point being shaded and outputs an irradiance energy component. The irradiance energy component is used to determine the surface color of the point. For example, the irradiance energy component can be used in conjunction with the surface material properties to compute the surface color of the point.
According to a further feature of the present invention, a three-dimensional irradiance vector field table representative of a three-dimensional irradiance field can be generated and stored in any type of memory including, but not limited to, texture memory. The irradiance vector field table can represent an irradiance field for one or more point light sources including, but not limited to, a point light source defined by a luminaire file format. The irradiance vector field table can also represent an irradiance field for area light sources including, but not limited to, direct area emitters, such as, light bulbs, fixtures, and other area luminaires, and indirect area emitters, such as, secondary reflections from objects in a scene or a combination of both direct and indirect area emitters.
Because light is represented in a vector field, standard vector field algebraic operations can be performed on the field. For example, the fields for two light sources can be added together to find a single field that represents their combined illumination. This can make it possible to incorporate lighting from a number of light sources without increasing the computation that must be performed when shading calculations are performed.
According to a feature of the present invention, the irradiance vector field table is generated to account for shadows, or participating media, such as fog or smoke. In one embodiment, visibility information is encoded in the irradiance vector field table to represent shadows and/or participating media in the scene.
In another embodiment of the present invention, irradiance vector field tables are computed without regard to shadows. Shadow maps are computed for a number of points on an emitter surface. The computed shadow maps are then used as in conventional shading calculations involving shadow maps as an approximation of how much of the light source is visible to the point being shaded. In particular, after a dot product operation is performed to obtain an irradiance energy component, the irradiance energy component is scaled using shadow map(s). Alternatively, standard back projection or shadow volume algorithms can be used to compute light source visibility from a point being shaded. The computed visibility is then used to scale the irradiance energy component.
According to a further feature of the present invention, a set of irradiance vector field tables is generated. Each table encompasses a larger volume of space. This reduces storage requirements and the number of computations needed to generate the table by taking advantage of situations where the irradiance field changes more slowly the farther away one is from the light source.
In one example implementation, a set of irradiance vector field tables is generated and stored as a clip-map (e.g., three-dimensional clip-map) to provide adaptive level-of-detail and to save texture memory. In the clip-map, the set of multi-resolutional irradiance field tables represent equal-size memory regions (also called tiles) which cover progressively larger regions of a scene at progressively coarser resolutions.
According to another embodiment of the present invention, multiple rendering passes are used to render a computer graphics image representing illumination from a complex point or area source. An irradiance vector field table is generated and stored in a texture memory. A first image is rendered using the irradiance vector field table to color pixels and stored in a first frame buffer. A second image is rendered and stored in a second frame buffer. The second image has surface normals encoded in red, green, and blue (RGB) color components.
To calculate a dot product, the first and second images are multiplied to obtain a third image. Components in the third image are accumulated to obtain a fourth image. The scene is rendered with any color and/or texture (not including the illumination represented by the irradiance field table) to obtain a fifth image. The fourth and fifth images are multiplied to obtain a final display image. This decoupling of the incident lighting component and the surface shading component is similar to the decoupling of incident lighting and texturing used to include texture mapping in a radiosity system (Gershbein, R., et al., xe2x80x9cTextures and Radiosity: Controlling Emission and Reflection with Texture Mapsxe2x80x9d in SIGGRAPH ""94 Proc.).
Thus, the present invention provides an efficient and general technique for computing incident light from point or area luminaires at interactive rates. Complex point and area luminaires can be simulated efficiently to provide high-quality shading, animation, and more realistic scenes. Common area light sources, such as, incandescent bulbs, fluorescent tubes, and lighting fixtures, and secondary reflections, can be represented in computer graphics shading and animation. In one embodiment, an efficient hardware implementation is realized which computes incident illumination light for one or more area light sources yet requires minimal additional hardware in a rendering pipeline.